#
# Projekt SIN
#

ifndef SYS
SYS=linux
endif

CPPC=g++
CPPFLAGS=-std=c++98 -O2 -g0 -pedantic -Wall -I ../include
MODULES=simulation.o time_controller.o extension_controller.o fuzzy_controller.o main.o generator.o Observer.o road_sensor.o road_queue.o road_part.o Semaphor_queue.o

all: program

program: $(MODULES)
	$(CPPC) $(MODULES) -L ../lib -l adevs_$(SYS) -l fuzzylite_$(SYS) -o program

simulation.o: simulation.cpp simulation.h io_type.h generator.h Observer.h Semaphor_queue.h road_sensor.h controller.h time_controller.h extension_controller.h fuzzy_controller.h
	$(CPPC) $(CPPFLAGS) -c -o simulation.o simulation.cpp

time_controller.o: time_controller.cpp time_controller.h controller.h io_type.h
	$(CPPC) $(CPPFLAGS) -c -o time_controller.o time_controller.cpp

extension_controller.o: extension_controller.cpp extension_controller.h controller.h io_type.h
	$(CPPC) $(CPPFLAGS) -c -o extension_controller.o extension_controller.cpp

fuzzy_controller.o: fuzzy_controller.cpp fuzzy_controller.h controller.h io_type.h
	$(CPPC) $(CPPFLAGS) -c -o fuzzy_controller.o fuzzy_controller.cpp

main.o: main.cpp simulation.o io_type.h generator.h Observer.h Semaphor_queue.h road_sensor.h controller.h time_controller.h extension_controller.h fuzzy_controller.h
	$(CPPC) $(CPPFLAGS) -c -o main.o main.cpp

generator.o: generator.cpp io_type.h generator.h
	$(CPPC) $(CPPFLAGS) -c -o generator.o generator.cpp

Observer.o: Observer.cpp io_type.h Observer.h
	$(CPPC) $(CPPFLAGS) -c -o Observer.o Observer.cpp

road_sensor.o: road_sensor.cpp io_type.h road_sensor.h
	$(CPPC) $(CPPFLAGS) -c -o road_sensor.o road_sensor.cpp

road_queue.o: road_queue.cpp io_type.h road_queue.h road_part.h
	$(CPPC) $(CPPFLAGS) -c -o road_queue.o road_queue.cpp

road_part.o: road_part.cpp io_type.h road_part.h
	$(CPPC) $(CPPFLAGS) -c -o road_part.o road_part.cpp

Semaphor_queue.o: Semaphor_queue.cpp io_type.h Semaphor_queue.h
	$(CPPC) $(CPPFLAGS) -c -o Semaphor_queue.o Semaphor_queue.cpp

.PHONY: clean clean-all

clean:
	rm -f *.o *~ *.bak

clean-all:
	rm -f *.o *~ *.bak program.exe


